package com.example.springiocdi.component;

import com.example.springiocdi.model.Student;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
public class StudentComponent {
    @Primary
    @Bean({"s1","s3"})
    public Student s1(){
        return new Student("张三",32);
    }
@Bean("s2")
    public Student s2(){
        return new Student("李四",42);
    }

    @Bean
    public String name(){
        return "lise";
    }
    @Bean String name2(){
        return "zhanghu";
    }


    @Bean
    public Student s4(String name){
        return new Student(name,12);
    }


    @Bean
    public Student s5(Student s1){
        return  new Student(s1.getName(), 89);
    }

    @Bean
    public Student s6(@Qualifier("name2") String n){
        return new Student(n,90);
    }

}
